

import 'building.dart';

class AccountInfo {
    String accountName;
    int accountType;
    List<Building> buildings;
    String deployType;

    AccountInfo({this.accountName, this.accountType, this.buildings, this.deployType});

    factory AccountInfo.fromJson(Map<String, dynamic> json) {
        return AccountInfo(
            accountName: json['accountName'], 
            accountType: json['accountType'], 
            buildings: json['buildings'] != null ? (json['buildings'] as List).map((i) => Building.fromJson(i)).toList() : null, 
            deployType: json['deployType'], 
        );
    }

    Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['accountName'] = this.accountName;
        data['accountType'] = this.accountType;
        data['deployType'] = this.deployType;
        if (this.buildings != null) {
            data['buildings'] = this.buildings.map((v) => v.toJson()).toList();
        }
        return data;
    }
}